home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr34 / bzip.zip / ZIPTEST.PRG < prev   
Text File  |  1994-12-18  |  2KB  |  99 lines

  1. /* Clipper 5.x mini-ZIP ID functions
  2.    (c) 1994 Base 12
  3.    December 1994
  4.    Programmer: Jose Jimenez Jr.
  5.    PKZIP(R) is a registered trademark of PKWARE(R)
  6.  
  7.    BZIP is a very tiny library that contains 3 functions.
  8.    It is used for reading information regarding ZIP files.  It does
  9.    not ZIP or UNZIP files.
  10.  
  11.    FUNCTIONS:
  12.  
  13.    Function  : ISZIP()
  14.    Parameters: file_name
  15.  
  16.    Purpose:  Verifies if the file is of PKZIP(R) format.
  17.  
  18.    Returns:  1 = Success
  19.              0 = Not a PKZIP(R) file
  20.             -1 = File not found
  21.             -2 = File could not be opened
  22.         -3 = Failed to read ID information
  23.             -4 = Failed to close file
  24.  
  25.    Function  : WHOMADEZIP()
  26.    Parameters: file_name
  27.  
  28.    Purpose:  Returns the OS that created file
  29.  
  30.    Returns:  char = OS that made ZIP
  31.  
  32.    Possible: MS-DOS and OS/2 (F.A.T. file systems)
  33.          Amiga                     
  34.              VAX/VMS
  35.          *nix
  36.              VM/CMS
  37.          Atari ST
  38.              OS/2 H.P.F.S.
  39.          Macintosh
  40.              Z-System
  41.          CP/M
  42.              Unknown
  43.  
  44.  
  45.    Function  : ZIPVERSION()
  46.    Parameters: file_name
  47.  
  48.    Purpose:  Returns the version of min. ZIP version needed to unzip
  49.  
  50.    Returns: float = Version of ZIP file, example: 2.00
  51.              -1 = File not found
  52.              -2 = File could not be opened
  53.          -3 = Failed to read ID information
  54.              -4 = Failed to close file
  55. */
  56.  
  57. @ 00,00 CLEAR  
  58. cfile := SPACE(12)
  59. @ 01,01 SAY "Enter file to verify: ";
  60.         GET cfile
  61. READ
  62. nret := ISZIP(cfile)
  63. DO CASE
  64.    CASE nret = -4
  65.       @ 03,01 SAY "Could not close file"
  66.    CASE nret = -3
  67.       @ 03,01 SAY "File ID could not be read, file may be damaged."
  68.    CASE nret = -2
  69.       @ 03,01 SAY "Could not open file."
  70.    CASE nret = -1
  71.       @ 03,01 SAY TRIM(cfile)+" could not be found."
  72.    CASE nret = 0
  73.       @ 03,01 SAY "File is not of PKZIP(R) format."
  74.    CASE nret = 1
  75.       @ 03,01 SAY "File is of PKZIP(R) format."
  76. ENDCASE
  77.  
  78. IF nret != 1
  79.    QUIT
  80. ENDIF
  81.  
  82. // in the following, the return codes are not tested.  
  83. // You can assume if the ISZIP() does not pass, the rest of the functions
  84. // will not work.
  85.  
  86. @ 05,01 SAY "Searching for OS data..."
  87. cret := WHOMADEZIP(cfile)
  88. @ 05,01 CLEAR
  89. @ 05,01 SAY "Zipped by : "+cret
  90.  
  91. @ 06,01 SAY "Seraching for version..."
  92. nver := ZIPVERSION(cfile)
  93. @ 06,01 CLEAR
  94. @ 06,01 SAY "Version of ZIP:"
  95. @ 06,17 SAY nver PICTURE "#.##"
  96.  
  97. QUIT
  98.  
  99.